package org.rency.ues.domain.request;

import org.rency.ues.common.enums.EncryptType;
import org.rency.ues.common.model.EncryptItem;

import javax.validation.Valid;
import javax.validation.constraints.NotNull;
import java.util.ArrayList;
import java.util.List;

/**
 * 批量加密请求
 *
 * @author: Created by user_rcy@163.com on 2016/8/2.
 */
public class EncryptBatchRequest extends BaseRequest{

    @Valid
    @NotNull(message = "加密项不能为空")
    private List<EncryptItem> encryptItems;

    /**
     * 加密类型
     */
    @NotNull(message = "加密类型不能为空")
    private EncryptType encryptType = EncryptType.RSA;

    @NotNull(message = "证书序列号不能为空")
    private String serialNo;

    public List<EncryptItem> getEncryptItems() {
        return encryptItems;
    }

    public void setEncryptItems(List<EncryptItem> encryptItems) {
        this.encryptItems = encryptItems;
    }

    public void addEncryptItem(EncryptItem encryptItem) {
        if(this.encryptItems == null){
            this.encryptItems = new ArrayList<EncryptItem>();
        }
        this.encryptItems.add(encryptItem);
    }

    public EncryptType getEncryptType() {
        return encryptType;
    }

    public void setEncryptType(EncryptType encryptType) {
        this.encryptType = encryptType;
    }

    public String getSerialNo() {
        return serialNo;
    }

    public void setSerialNo(String serialNo) {
        this.serialNo = serialNo;
    }
}
